package com.xiaoKe.zhonghzu.ui.gather;

import android.content.Context;
import android.icu.util.LocaleData;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
import com.bigkoo.pickerview.view.OptionsPickerView;
import com.xiaoKe.zhonghzu.R;
import com.xiaoKe.zhonghzu.global.tool.CodeTool;
import com.xiaoKe.zhonghzu.global.tool.DateUtils;
import com.xiaoKe.zhonghzu.global.tool.PvOptions;
import com.xiaoKe.zhonghzu.ui.onClick.NoDoubleClickListener;
import com.xiaoKe.zhonghzu.ui.onClick.OnClickListenerPositionObject;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

/**
 * @ProjectName : xiaoke-pad-zhongzhu
 * @Author : Shijingna
 * @Time : 2024/12/18 13:52
 * @Description : 文件描述
 */
public class ViewAddHead extends LinearLayout {
    public ViewAddHead(Context context) {
        super(context);
    }

    public ViewAddHead(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public ViewAddHead(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    RelativeLayout dateRelative, addressRelativeLayout,codeRelativeLayout;
    TextView dateTv, address;
    List<String> addressList = new ArrayList<>();

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
//        addressList.add("中国武汉种猪测定中心");
//        addressList.add("中国武汉种猪测定中心");
//        addressList.add("中国武汉种猪测定中心");
//        addressList.add("中国武汉种猪测定中心");
//        codeRelativeLayout = findViewById(R.id.codeRelativeLayout);
//        addressRelativeLayout = findViewById(R.id.addressRelativeLayout);
//        address = findViewById(R.id.address);
//        dateRelative = findViewById(R.id.dateRelative);
//        dateTv = findViewById(R.id.dateTv);
//
//        dateTv.setText(LocalDate.now().toString());
//        NoDoubleClickListener noDoubleClickListener = new NoDoubleClickListener() {
//            @Override
//            protected void onNoDoubleClick(View view) {
//                switch (view.getId()) {
//                    case R.id.dateRelative: //时间选择
//                        PvOptions.getDateDay(getContext(),new OnClickListenerPositionObject() {
//                            @Override
//                            public void onItemClick(Object ob) {
//                                dateTv.setText(ob.toString());
//                            }
//                        });
//                        break;
//                    case R.id.addressRelativeLayout: //选择列表
//                        OptionsPickerView optionsPickerView = PvOptions.initOptionPicker(getContext(),new OnOptionsSelectListener() {
//                            @Override
//                            public void onOptionsSelect(int options1, int options2, int options3, View v) {
//                                address.setText(addressList.get(options1));
//                            }
//                        });
//                        optionsPickerView.setPicker(addressList);
//                        optionsPickerView.show();
//                        break;
//
//                }
//            }
//        };
//        dateRelative.setOnClickListener(noDoubleClickListener);
//        addressRelativeLayout.setOnClickListener(noDoubleClickListener);
    }
    Fragment fragment;
    public void intoData( Fragment fragment){
        this.fragment = fragment;
    }
}
